package ioc

import (
	"github.com/gin-gonic/gin"
	"mts/trans_srv/internal/web"
	middleware "mts/trans_srv/internal/web/middleware"
)

func InitWebServer(handlers ...web.Handler) *gin.Engine {
	engine := gin.Default()
	engine.Use(middleware.Cors()) // 全局跨域配置
	group := engine.Group("/lan/v1")
	// 遍历所有 handler 并注册路由
	for _, handler := range handlers {
		handler.RegisterRoutes(group)
	}
	return engine
}
